const api = {
	cancel: '/front/mall/orders/cancelOrders',
	add: '/front/mall/orders/addOrders',
	selectAllInfo:'/front/mall/orders/selectOrdersByUserId',
	delete:'/front/mall/orders/deleteOrdersList',
	selectById:'/front/mall/orders/selectOrdersById',
	toReceive:'/front/mall/orders/confirmOrder'
}

// 取消订单
// 添加是否需要登录的options选项
export const cancelOrder = (ordersId) => {  
  return uni.$http.get(`${api.cancel}/${ordersId}`);  
}

// 添加订单
export const addOrder = (generateOrders) => {
  
  return uni.$http.post(api.add, generateOrders);
}

// export const addOrder = (generateOrders) => {  
//   return uni.$http.post(api.add, JSON.stringify(generateOrders), {  
//     headers: {  
//       'Content-Type': 'application/json'  
//     }  
//   });  
// }
// 查询用户所有订单
export const selectAllInfo=()=>{
	return uni.$http.get(api.selectAllInfo);
}

// 删除订单列表
export const deleteOrdersList = (id) => {
  return uni.$http.get(`${api.delete}/${id}`);
}

export const  selectById=(id)=>{
	return uni.$http.post(api.selectById,id);
}


export const toReceive=(id)=>{
	  return uni.$http.get(`${api.toReceive}/${id}`);
}